﻿/*
SINACOR - BMF&Bovespa
Arquivo: NoSituacaoCasamento.cs
Criado em: 07-abr-2010 15:53:21
Arquiteto Responsável: p-RAMelo
*/
using System;
using System.Collections.Generic;
using System.Text;
using Sinacor.Infra.UI.Common;
using System.Collections;
using System.Collections.ObjectModel;


namespace Sinacor.UI.Bovespa.ManutencaoOrdens.Model 
{
	/// <summary>
	/// Nó representa a situação do casamento da ordem
	/// </summary>
	[Serializable]
	public class NoSituacaoCasamento : BaseModel, Sinacor.Infra.UI.Common.IHierarchicalItem<IHierarchicalItem,IHierarchicalItem,ObservableCollection<IHierarchicalItem>> 
	{

		#region Construtor

		/// <summary>
		/// Construtor padrão
		/// </summary>
		/// <param name="parent"></param>
		/// <param name="situacao"></param>
		public NoSituacaoCasamento(IHierarchicalItem parent, Model.Enum.SituacaoCasamento situacao)
		{
			this._situacao = situacao;
            _children = new ObservableCollection<IHierarchicalItem>();
            _parent = parent;
		}

		#endregion

		#region Atributos

        private ObservableCollection<IHierarchicalItem> _children;
		private IHierarchicalItem  _parent;
		private Model.Enum.SituacaoCasamento _situacao;

		#endregion

		#region Métodos

        /// <summary>
        /// Children
        /// </summary>
        /// <returns></returns> 
        public ObservableCollection<IHierarchicalItem> Children
		{
            get 
            { 
                return _children; 
            }
            
		}

        /// <summary>
        /// Children
        /// </summary>
        System.Collections.IEnumerable Sinacor.Infra.UI.Common.IHierarchicalItem.Children
        {
            get { return (System.Collections.IEnumerable)_children; }
        }

        /// <summary>
        /// Parent
        /// </summary>
        /// <returns></returns>
		public IHierarchicalItem  Parent
		{
            get 
            { 
                return _parent; 
            }
            set
            {
                SetValue<IHierarchicalItem>("Parent", ref _parent, value);
            }
		}

        /// <summary>
        /// Parent
        /// </summary>
        Sinacor.Infra.UI.Common.IHierarchicalItem Sinacor.Infra.UI.Common.IHierarchicalItem.Parent
        {
            get { return (Sinacor.Infra.UI.Common.IHierarchicalItem)_parent; }
        }

        /// <summary>
        /// Situação
        /// </summary>
        /// <returns></returns>
		public Model.Enum.SituacaoCasamento Situacao
		{
            get { return _situacao; }
		}

        /// <summary>
        /// Text
        /// </summary>
        /// <returns></returns>
		public String Text
		{            
            get 
            {
                if(_parent is Model.NoTipoObjetoConsulta)
                {
                    if(_situacao == Model.Enum.SituacaoCasamento.Casada)
                        return PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.Ordens.Label.CasadosEParcial").ToString();
                    else
                        return PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.Ordens.Label.NaoCasados").ToString();
 
                }
                else 
                {
                    if(_situacao == Model.Enum.SituacaoCasamento.Casada)
                        return PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.Ordens.Label.Casadas").ToString() + " + " + PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.Ordens.Label.CasadasParcialmente").ToString();
                    else
                        return PSE.Framework.UI.Resources.ResourceProviderManager.GetResourceProvider().TryGetResource("Bovespa.Ordens.Label.NaoCasadas").ToString();
                }               
            }
		}

		#endregion

	}

}